<!DOCTYPE html>
<html>
<head>
<title></title> <@h.head />


<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}
</style>
</head>
<body>
	<form class="form-inline definewidth m20" action="${path}/onlineLink/list" method="post" id="listForm">
		标题： <input type="text" name="title" id="title"
			class="abc input-default" placeholder="请输入标题" value="${(RequestParameters['title'])!''}">&nbsp;&nbsp;
		<button type="submit" class="btn btn-primary">查询</button>
		&nbsp;&nbsp; 
		<a class="btn btn-success" href="${path}/onlineLink/add">新增购物平台</a>
	</form>
	<table class="table table-bordered table-hover definewidth m10">
		<thead>
			<tr>
				<th>标题</th>
				<th>描述</th>
				<th>logo</th>
				<th>排序</th>
				<th>链接</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<#list list as record>
			<#assign imgLogo=(imgMap[record.id?string])!>
			<tr id="rowid${record.id}">
				<td>${(record.title)!""}</td>
				<td title="${(record.content)!}">
					<#if record.content?? && (record.content?length gt 30)>
						${(record.content[0..30?number])!}...
					<#else>
						${(record.content)!}
					</#if>
				</td>
				<td><a target="_blank" href="${imgLogo.path!}">${imgLogo.name!}</a></td>
				<td>${(record.sort)!""}</td>
				<td>
					<a href="${(record.buyLink)!'#'}" target="_blank">
					<#if record.buyLink?? && (record.buyLink?length gt 30)>
						${(record.buyLink[0..30?number])!}...
					<#else>
						${(record.buyLink)!}
					</#if>
					</a>
				</td>
				<td>
				<a class="edit" href="${path}/onlineLink/add?id=${record.id}">修改</a>
				&nbsp;&nbsp;<a class="del" href="javascript:del('${record.id}')">删除</a>
				</td>
			</tr>
			</#list>
		</tbody>
	</table>
	<@h.page />
	<@h.foot />
</body>
<script type="text/javascript">
function del(id){
	if(confirm("是否删除?")) {
		$.ajax({
			  url: "${path}/onlineLink/delete",
			  data: {'id':id},
			  dataType: "json",
			  success: function(data){
				  if (data.status == 0) {
					  $("#rowid"+id).remove();
				  } else{
					  alert(data.msg);
				  }
			  }
		});
	}
}
</script>
</html>
